package cn.aifeix.org.enu;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum ShopStateEnum {
    WAIT_AUDIT(0,"待审核"),
    HAVE_AUDIT(1,"已审核"),
    REJECT(-1,"驳回"),
    PASS(2,"已激活");

    private int code;

    private String name;

    public static String getNameByCode(Integer code){
        ShopStateEnum[] values = ShopStateEnum.values();
        ShopStateEnum StateEnum = Arrays.stream(ShopStateEnum.values()).filter(state -> state.getCode() == code)
                .findAny().orElse(null);
        return null == StateEnum?"":StateEnum.getName();
    }
}
